refactor(disable): reduce complexity of run() in disable.rs#1489
Merged
jamesadevine merged 1 commit intoJul 13, 2026
Merged
Conversation
Extract ApplyOutcome enum and apply_action() helper so the per-definition
loop body is a flat three-arm match instead of nested match-if-match.
- New: ApplyOutcome { Skipped, Patched, Failed } enum
- New: apply_action() — handles one Action, prints status, returns outcome
- run() loop reduced from ~25 lines of nested control flow to 6 lines
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jamesadevine
approved these changes
Jul 13, 2026
jamesadevine
marked this pull request as ready for review
July 13, 2026 10:09
jamesadevine
deleted the
refactor/reduce-complexity-disable-run-91f4f9feffffac78
branch
July 13, 2026 11:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
run()function insrc/disable.rshad a nestedmatch → if → matchpattern inside its per-definition loop that made the control flow harder to follow. This PR extracts the loop body into a focused helper.What changed
New:
ApplyOutcomeenumNew:
apply_action()async helperHandles one
Action, prints a one-line status message, and returns the outcome — no tallying, no loop concerns. The dry-run check and the HTTP call are now a flat two-armmatchinstead of a nestedif { ... } match { Ok match { ... } Err ... }.run()loop simplifiedComplexity delta
run()apply_action()Checklist
cargo build— cleancargo test— all passcargo clippy --all-targets --all-features— zero warningsWarning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comSee Network Configuration for more information.